{% extends "Themes/Itdashu/templates/page.twig" %}
{% block head %}
    <title>{{ title }}{% if page > 1 %}({{ page }}){% endif %}-{{ webConfig.name }}</title>
    <meta name="description"
          content="{% if data.description is defined AND data.description %}{{ data.description }}{% else %}{{ subString(data.body,80,true) }}{% endif %}">
    <meta name="keywords" content="{% if keywords is defined %}{{ keywords }}{% else %}{{ title }}{% endif %}">
    <meta name="apple-mobile-web-app-title" content="{{ title }}">
{% endblock %}

{% block body %}
    <div class="col-lg-9 col-md-9 left-box">
        {{ content() }}
        <article class="node">
            <div class="header">
                <h1 class="title">
                    <a href="{{ url(['for':'node','contentModel':data.contentModel,'id':data.getId()]) }}">{{ data.title }}</a></h1>
                <div class="meta">
                    <span class="changed">{{ timeTran(data.changed) }}</span>
                    <span class="author">发布者：
                        {% if data.uid AND data.user %}
                            <a href="{{ url(['for':'user','id':data.uid]) }}">{{ data.user.name }}</a>
                        {% endif %}
                    </span>
                    <span class="browse">阅读(<i class="node-browse">{{ data.browse }}</i>)</span>
                    <span class="comment-num">评论({{ data.commentNum }})</span>

                    <span class="tags">
                        标签：
                        {% for item in term(data.tags) %}
                            <a rel="tag" href="{{ url(['for':'term','contentModel':item.contentModel,'id':item.getId(),'page':1]) }}">{{ item.name }}</a>
                        {% endfor %}
                    </span>
                </div>
            </div>
            {% if count(nodePagination) > 1 %}
                {{ nodePagination[currentPageIndex] }}
                {% include 'Themes/Itdashu/templates/nodePagination.twig' %}
            {% else %}
                <div class="body">
                    {{ view.r(regionRender('content_header')) }}
                    {{ data.body }}
                </div>
            {% endif %}
        </article>
        {{ view.r(zanNode(data)) }}
        <ul class="node-action-links">
            {% if data.book_id is defined AND data.book_id is not 'null' %}
                {% for key,value in nodeBookActionLink(data) %}
                    <li class="{{ key }}">{{ value['label'] }}：
                        <a class="highlight" href="{{ value['href'] }}">{{ value['title'] }}</a>
                    </li>
                {% endfor %}
            {% else %}
                {% for key,value in nodeActionLink(data) %}
                    <li class="{{ key }}">{{ value['label'] }}：
                        <a class="highlight" href="{{ value['href'] }}">{{ value['title'] }}</a>
                    </li>
                {% endfor %}
            {% endif %}
        </ul>
        {{ view.r(regionRender('content_footer')) }}
        {{ view.r(comment(data)) }}
    </div>
{% endblock %}

{% block right_box %}
    {% if data.book_id is defined AND data.book_id is not 'null' %}
        {{ view.r(regionRender('book_right')) }}
    {% else %}
        {{ view.r(regionRender('right')) }}
    {% endif %}
{% endblock %}

{% block bottom %}
    <script src="//cdn.bootcss.com/highlight.js/8.0/highlight.min.js"></script>
    <link href="//cdn.bootcss.com/highlight.js/8.0/styles/monokai_sublime.min.css" rel="stylesheet">
    <script src="/themes/itdashu/js/node.js"></script>
{% endblock %}
